\subsection{Introduction}
Algebraic geometry studies the duality between systems of polynomial equations and the geometry or topology of their solution sets.
If we have a system of polynomials
\[ f_1, \dots, f_r \in \symbb k[X_1, \dots, X_n] = \symbb k[\vb X] \]
we can form its solution set
\[ V = \qty{P \in \symbb k^n \mid f_1(P) = \dots = f_r(P) = 0} \subseteq \symbb k^n \]
On the algebraic side, we have the ideal
\[ I = (f_1, \dots, f_r) \vartriangleleft \symbb k[\vb X] \]
The duality we are interested in is between \( R = \faktor{\symbb k[\vb X]}{I} \) and the geometry of \( V \).

We may impose some assumptions on the field \( \symbb k \).
\begin{itemize}
    \item We might assume that \( \symbb k \) is algebraically closed, which is a natural assumption since we wish to consider roots to polynomials with coefficients in \( \symbb k \).
    \item We could also take the stronger assumption that \( \symbb k \) is algebraically closed and has characteristic 0.
    Occasionally, we may want to differentiate a polynomial, and so it becomes inconvenient to do algebra without this assumption.
    \item Throughout the course, we will in fact assume \( \symbb k = \mathbb C \), as we are not particularly interested in the subtleties of such fields other than \( \mathbb C \), and it is useful for intuition.
\end{itemize}
Questions we may ask about this duality are:
\begin{itemize}
    \item To what extent do \( R \) and \( V \) determine each other?
    \item What is the right notion of dimension of \( V \), in terms of algebra?
    \item Can we detect whether \( V \subseteq \mathbb C^n \) is a manifold based on the information contained within \( R \)?
    \item Is \( V \) compact?
    If not, is there a natural way to compactify the space into some space \( \overline V \) that is in some sense algebraic?
\end{itemize}

\subsection{Affine space}
\begin{definition}
    The \emph{affine space of dimension \( n \)}, implicitly over \( \mathbb C \), is the set \( \mathbb A^n = \mathbb C^n \).
    The elements of \( \mathbb A^n \) are called \emph{points}, denoted \( P = (\vb a) = (a_1, \dots, a_n) \).
\end{definition}
\begin{definition}
    An \emph{affine subspace} of \( \mathbb A^n \) is any subset of the form \( v + U \subseteq \mathbb C^n \) where \( U \subseteq \mathbb C^n \) is any linear subspace, and \( v \in \mathbb C^n \).
\end{definition}
\( \mathbb A^n \) is the natural set on which \( \mathbb C[X_1, \dots, X_n] \) is a ring of functions.
Given \( f \in \mathbb C[\vb X] \), we obtain a function \( f \colon \mathbb A^n \to \mathbb C \).
The subset \( \mathbb C \subseteq \mathbb C[\vb X] \) is the set of constant functions.
\begin{proposition}
    The polynomial ring \( \mathbb C[\vb X] \) satisfies the following properties.
    \begin{enumerate}
        \item \( \mathbb C[\vb X] \) is a unique factorisation domain.
        \item Every ideal in \( \mathbb C[\vb X] \) is finitely generated (equivalently, \( \mathbb C[\vb X] \) is Noetherian), due to the Hilbert basis theorem.
    \end{enumerate}
\end{proposition}

\subsection{Affine varieties}
\begin{definition}
    Let \( S \subseteq \mathbb C[\vb X] \) be any subset of \( \mathbb C[\vb X] \).
    The \emph{vanishing locus} of \( S \) is defined to be \( \mathbb V(S) = \qty{P \in \mathbb A^n \mid \forall f \in S,\, f(P) = 0} \).
\end{definition}
\begin{definition}
    An \emph{affine (algebraic) variety in \( \mathbb A^n \)} is a set of the form \( \mathbb V(S) \) for some \( S \).
\end{definition}
Note that there is some inconsistency between definitions in different textbooks; some authors also impose an irreducibility condition.
\begin{example}
    \begin{enumerate}
        \item Let \( n = 1 \).
        The polynomial \( f \in \mathbb C[X] \) gives the vanishing locus \( \mathbb V(f) \subseteq \mathbb A^1 \), the set of zeroes of \( f \).
        Conversely, if \( V \subseteq \mathbb A^1 \) is finite, then \( V = \mathbb V(f) \) where \( f = \prod_{a \in V} (x - a) \).
        \item A \emph{hypersurface} in \( \mathbb A^n \) is a variety of the form \( \mathbb V(f) \) where \( f \in \mathbb C[X] \).
        \item It is often convenient to represent varieties not by equations but parametrically.
        The \emph{affine twisted cubic} is \( C = \qty{(t, t^2, t^3) \mid t \in \mathbb C} \subset \mathbb A^3 \).
        This is a variety, as it is the vanishing locus of the two polynomials \( X_1^2 - X_2 \) and \( X_1^3 - X_3 \).
    \end{enumerate}
\end{example}
\begin{theorem}
    Let \( S \subseteq \mathbb C[\vb X] \).
    Then,
    \begin{enumerate}
        \item Let \( I \subseteq \mathbb C[\vb X] \) be the ideal generated by \( S \).
        Then, \( \mathbb V(S) = \mathbb V(I) \).
        \item There exists a finite subset \( \qty{f_j} \) of \( S \) such that \( \mathbb V(S) = \mathbb V(\qty{f_j}) \).
    \end{enumerate}
\end{theorem}
\begin{proof}
    \emph{Part (i).}
    Suppose \( P \in \mathbb A^n \).
    Then, \( f(P) = 0 \) for all \( f \in S \) if and only if \( f(P) = 0 \) for all \( f \in I \), by the basic properties of ideals.

    \emph{Part (ii).}
    By (i), \( \mathbb V(S) = \mathbb V(I) \).
    \( I \) is finitely generated, so there exist functions \( h_1, \dots, h_r \in I \) that generate \( I \).
    Reversing (i), \( \mathbb V(I) = \mathbb V(\qty{h_i}) \).
    But since \( I \) is generated by \( S \), each \( h_i \) can be written as a linear combination of finitely many elements of \( S \).
    So \( h_i = \sum_j g_{ij} f_j \) where \( f_j \in S \).
    Then \( \mathbb V(S) = \mathbb V(\qty{f_j}) \).
\end{proof}
\begin{proposition}
    Let \( S, T \subseteq \mathbb C[\vb X] \).
    Then,
    \begin{enumerate}
        \item \( S \subseteq T \) implies \( \mathbb V(T) \subseteq \mathbb V(S) \).
        \item \( \mathbb V(0) = \mathbb A^n \), and \( \mathbb V(\mathbb C[\vb X]) = \mathbb V(\lambda) = \varnothing \) where \( \lambda \in \mathbb C \setminus \qty{0} \).
        \item \( \bigcap_j \mathbb V(I_j) = \mathbb V\qty(\sum_j I_j) \) for any family of ideals \( I_j \).
        \item \( \mathbb V(I) \cup \mathbb V(J) = \mathbb V(I \cap J) \).
    \end{enumerate}
\end{proposition}
\begin{proof}
    Part (i) and (ii) are trivial.

    \emph{Part (iii).}
    We have \( \bigcap_j \mathbb V(I_j) = \mathbb V\qty(\bigcup_j I_j) \).
    To conclude, note that the ideal generated by \( \bigcup_j I_j \) is \( \sum_j I_j \).

    \emph{Part (iv).}
    We have already seen that \( \mathbb V(I) \cup \mathbb V(J) \subseteq \mathbb V(I \cap J) \).
    For the reverse containment, suppose \( P \in \mathbb V(I \cap J) \), and suppose \( P \not\in \mathbb V(I) \).
    Then, there exists some \( g \in I \) such that \( g(P) = 0 \).
    Moreover, for all elements \( f \in J \), \( fg \in I \cap J \), so \( (fg)(P) = 0 \).
    Hence \( f(P) = 0 \) for all \( f \in J \), so \( P \in \mathbb V(J) \).
\end{proof}

\subsection{Irreducible varieties}
\begin{definition}
    A variety \( V \) is called \emph{irreducible} if whenever \( V = V_1 \cup V_2 \), where \( V_1, V_2 \) are varieties, we have \( V = V_1 \) or \( V = V_2 \).
    A variety that is not irreducible is called reducible.
\end{definition}
\begin{example}
    The variety \( V = \mathbb V(XY) \) is reducible, as it is the union of \( \mathbb V(X) \) and \( \mathbb V(Y) \).
\end{example}
\begin{proposition}
    Every affine variety \( V \) is a finite union of irreducible varieties.
\end{proposition}
This proof uses a `bisection' argument.
\begin{proof}
    If \( V \) is irreducible, there is nothing to prove.
    Otherwise, \( V = V_1 \cup V_1' \), where \( V_1, V_1' \neq V \).
    If \( V_1, V_1' \) are finite unions of irreducible varieties, the proof is already complete.
    Suppose \( V_1 \) is not a finite union of irreducibles.
    Then, it follows that \( V_1 = V_2 \cup V_2' \) nontrivially.
    Inductively, we obtain
    \[ V = V_0 \supsetneq V_1 \supsetneq V_2 \supsetneq V_3 \supsetneq \dots \]
    This infinite descending chain never stabilises.
    Define
    \[ W = \bigcap_{j=0}^\infty V_j = \mathbb V\qty(\sum_{j=0}^\infty I_j) \]
    But \( \sum_{j=0}^\infty I_j \) is finitely generated.
    So \( \sum_{j=0}^\infty I_j = \sum_{j \leq N} I_j \) for some \( N \in \mathbb N \).
    Hence, \( W = \bigcap_{j \leq N} V_j \) contradicting that the descending chain never stabilises.
\end{proof}
\begin{definition}
    Let \( V \) be an affine variety.
    A \emph{minimal decomposition} of \( V \) is a representation of \( V \) as a finite union of distinct irreducibles \( V_i \) such that no \( V_i \) is contained within \( V_j \).
\end{definition}
\begin{proposition}
    Minimal decompositions of affine varieties are unique up to ordering.
\end{proposition}
\begin{proof}[Proof sketch]
    This proof is left as an exercise.
    One can compare two decompositions by intersecting the irreducible components of one decomposition with the other.
\end{proof}
Given uniqueness of minimal decompositions, we can refer to the irreducibles appearing in such a decomposition as the \emph{irreducible components} of a variety.

\subsection{Zariski and Euclidean topologies}
\begin{definition}
    The \emph{Zariski topology} on \( \mathbb A^n \) is the topology where the closed sets are precisely the affine varieties.
    If \( V \subseteq \mathbb A^n \) is a (sub)variety, the Zariski topology on \( V \) is the subspace topology for the Zariski topology on \( \mathbb A^n \).
\end{definition}
\begin{remark}
    This is in fact a topology, as all of the relevant axioms have been proven.
\end{remark}
\begin{definition}
    The \emph{Euclidean topology} or \emph{analytic topology} on \( \mathbb A^n \) is the topology induced by the metric space structure on \( \mathbb C^n \).
    If \( V \subseteq \mathbb A^n \), the Euclidean topology on \( V \) is the subspace topology of the Euclidean topology on \( \mathbb A^n \).
\end{definition}
\begin{proposition}
    The Zariski topology on \( \mathbb A^1 \) coincides with the cofinite topology; the closed sets are exactly the finite sets.
    This topology is not Hausdorff but it is compact.
    The Euclidean topology on \( \mathbb A^1 \) is Hausdorff but not compact.
\end{proposition}
\begin{remark}
    \( \mathbb A^2 \) with the Zariski topology is not homeomorphic to \( \mathbb A^1 \times \mathbb A^1 \) with the product of the Zariski topologies.
\end{remark}

\subsection{Ideals from zero sets}
\begin{theorem}[weak form of Hilbert's Nullstellensatz]
    Every maximal ideal in \( \mathbb C[\vb X] \) has the form \( (X_1 - a_1, \dots, X_n - a_n) \) for \( a_i \in \mathbb C \).
    Moreover, if \( I \) is any non-unit ideal, \( \mathbb V(I) \neq \varnothing \subseteq \mathbb A^n \).
\end{theorem}
We prove this over the complex numbers; the given proof only works for this case, but the statement holds for all algebraically closed fields.
\begin{proof}
    Every ideal of this form has quotient \( \mathbb C \), so they are all maximal.
    Let \( \mathfrak m \vartriangleleft \mathbb C[\vb X] \) be a maximal ideal, and let \( K = \faktor{\mathbb C[\vb X]}{\mathfrak m} \).
    \( K \) is a field as \( \mathfrak m \) is maximal, and it is a field extension of \( \mathbb C \).
    Define \( a_i \) to be the coset \( X_i + \mathfrak m \).
    If \( a_i \in \mathbb C \) for all \( i \), this gives the result as required because the ideal is generated by \( (X_1 - a_1, \dots, X_n - a_n) \).

    Otherwise, \( K \supsetneq \mathbb C \).
    But \( \mathbb C \) is algebraically closed, so there exists \( t \in K \setminus \mathbb C \) which is transcendental over \( \mathbb C \).
    Let \( U_m \) be the \( \mathbb C \)-span inside \( K \) of products of the form \( a_1^{r_1} \dots a_n^{r_n} \) where the \( r_i \) are nonnegative, and \( \sum_{i=1}^n r_i \leq m \).
    Observe that \( U_m \) is finite-dimensional, and \( K = \bigcup_{m \geq 0} U_m \) is countable-dimensional.
    One can show that the elements \( \qty{\frac{1}{t - c} \mid c \in \mathbb C} \) are linearly independent over \( \mathbb C \).
    There are uncountably many such elements, giving a contradiction.

    For the last part, let \( I \) be a nonzero ideal.
    There exists a maximal ideal \( \mathfrak m \supseteq I \), so \( \mathbb V(I) \supseteq \mathbb V(\mathfrak m) \), but \( \mathbb V(\mathfrak m) \) is nonempty as it contains the point \( (a_1, \dots, a_m) \).
\end{proof}
\begin{definition}
    Let \( V \subseteq \mathbb A^n \) be an affine variety.
    The \emph{ideal of functions vanishing on \( V \)} is \( I(V) = \qty{f \in \mathbb C[\vb X] \mid \forall P \in V,\, f(P) = 0} \).
\end{definition}
\begin{proposition}
    Let \( V \subseteq \mathbb A^n \) be an affine variety.
    Then,
    \begin{enumerate}
        \item If \( V = \mathbb V(S) \) where \( S \subseteq \mathbb C[\vb X] \), then \( S \subseteq I(V) \).
        In particular, \( I(V) \) is the largest ideal vanishing on \( V \).
        \item \( V = \mathbb V(I(V)) \).
        \item Varieties \( V, W \subseteq \mathbb A^n \) are equal if and only if \( I(V) = I(W) \).
    \end{enumerate}
\end{proposition}
\begin{proof}
    Follows from the definitions.
\end{proof}
Therefore, we have an injective map \( I \) from the space of affine varieties in \( \mathbb A^n \) to the space of ideals in \( \mathbb C[\vb X] \), and \( \mathbb V \) gives a left inverse.
\begin{proposition}
    If \( V, W \) are affine varieties, \( V \subseteq W \) if and only if \( I(W) \subseteq I(V) \).
\end{proposition}
\begin{proof}
    The forward implication follows from set theory.
    For the reverse, if \( V \not\subseteq W \), we can choose \( P \in V \setminus W \).
    Since \( P \not\in \mathbb V(I(W)) \), there exists a function \( f \in I(W) \) such that \( f(P) \neq 0 \), so \( f \not\in I(V) \).
\end{proof}
\begin{proposition}
    Let \( V \) be a variety.
    Then \( V \) is irreducible if and only if \( I(V) \) is a prime ideal.
\end{proposition}
Recall that \( I(V) \) is prime when \( f_1 f_2 \in I(V) \) implies \( f_1 \in I(V) \) or \( f_2 \in I(V) \).
Geometrically, the ideal is not prime when we can find two functions where the product is zero on \( V \) but are individually not zero on all of \( V \).
\begin{proof}
    Recall that \( I(V_1 \cup V_2) = I(V_1) \cap I(V_2) \).
    Suppose \( V \) were reducible, so \( V = V_1 \cup V_2 \) where \( V_1, V_2 \neq V \).
    In particular, \( V_1 \not\subseteq V_2 \not\subseteq V_1 \).
    Now, let \( I_j = I(V_j) \), giving \( I_1 \not\supseteq I_2 \not\supseteq I_1 \), and \( I(V) = I_1 \cap I_2 \).
    Therefore, there exists \( f_1 \in I_1 \setminus I_2 \) and \( f_2 \in I_2 \setminus I_1 \).
    Each \( f_i \) is not an element of \( I(V) \), but \( f_1 f_2 \in I(V) \).
    So \( I(V) \) cannot be prime.

    Conversely, suppose \( I(V) \) is not prime, so \( f_1 f_2 \in I(V) \) but \( f_1, f_2 \not\in I(V) \).
    Define \( V_1 = V \cap \mathbb V(f_1) \) and \( V_2 = V \cap \mathbb V(f_2) \).
    Since neither \( f_i \) is contained in \( I(V) \), \( V_i \neq V \).
    Also, if \( P \in V \), we have \( f_1(P) f_2(P) = 0 \), so \( P \in V_1 \cup V_2 \).
    So \( V \) is reducible.
\end{proof}
\begin{example}
    Let \( V = \mathbb V(XY) \subset \mathbb A^2 \).
    Then \( V = \mathbb V(X) \cup \mathbb V(Y) \) is a decomposition of \( V \) into irreducible components.
    Indeed, \( \mathbb V(X) \) is irreducible, as \( I(\mathbb V(X)) = (X) \) is a prime ideal in \( \mathbb C[X, Y] \), and similarly for \( Y \).
\end{example}
